//
//  UserHeadBnt.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/2/17.
//  Copyright © 2016年 game. All rights reserved.
//

#import "UserHeadBnt.h"
#import "Masonry.h"
@implementation UserHeadBnt

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self Creat];
    }
    return self;
}

-(void)Creat{

    _userhead = [UIImageView new];
    radius(_userhead, (H(self)-10)/2);
    
    [self addSubview:_userhead];
    
    [_userhead mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(@5);
        make.bottom.equalTo(@-5);
        make.width.equalTo(@(H(self)-10));
        
    }];
    
    
    _userName = [UILabel new];
    [self addSubview:_userName];
    
    [_userName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_userhead.mas_right).offset(10);
        make.top.equalTo(_userhead);
    }];
    
    _flood = [UIButton new];
    _flood.layer.borderWidth = 0.7;
    _flood.layer.borderColor = mainColor.CGColor;
    radius(_flood, 5);
    [_flood setTitleColor:mainColor forState:UIControlStateNormal];
    
    _flood.titleLabel.font = font(SCREEN_WIDTH*0.04);
    [self addSubview:_flood];
    
    [_flood mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-15);
        make.centerY.equalTo(self);
        make.height.equalTo(@25);
    }];
    
    _live = [UILabel new];
    _live.backgroundColor = mainColor;
    _live.textColor = [UIColor whiteColor];
    _live.font = font(SCREEN_WIDTH*0.03);
    [self addSubview:_live];
    [_live mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_userName);
        make.bottom.equalTo(_userhead).offset(-2);
    }];

    UIView *lin  = [UIView new];
    lin.backgroundColor = linColor;
    [self addSubview:lin];
    
    [lin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo (self);
        make.height.equalTo(@0.5);
    }];
}

@end
